<?php
include_once($_SERVER['DOCUMENT_ROOT'] . '/smartrfid/model/orderStatus.php');
include_once($_SERVER['DOCUMENT_ROOT'] . '/smartrfid/model/order.php');
include_once($_SERVER['DOCUMENT_ROOT'] . '/smartrfid/model/ticket.php');

$id = $_GET['ticketId'];
if(empty($id))
  $id = 0;
$t=new OrderStatus();
$t->load($id);

$isCheckedOut = $_GET['isCheckedOut'];
$isStaged = $_GET['isStaged'];
$isReturned = $_GET['isReturned'];


$query = "UPDATE `" . $t->_table . "` SET ";

$query .= " `isCheckedOut` = ".$isCheckedOut;

$query .= ", `isStaged` = ".$isStaged;

$query .= ", `isReturned` = ".$isReturned;

$ticket = new Ticket();
$ticket->load($id);
//get orderid from ticketid
$order = new Order();
$order->loadByIdentifier($ticket->identifier);

$query .= " WHERE `order_id` = ". $order->id;
DBHelper::updateQuery($query);

?>
